import redis

# 实例化
r = redis.Redis(password='123456', decode_responses=True)

# 设置
print(r.lpush('list', 1, 2, 3, 4))

# 获取
print(r.lrange('list', 0, -1))
# 关闭连接
r.close()